<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); ?>
<div class="span9">

    <?php echo get_message(); ?>
    <h2><?php echo $titulo; ?></h2>

    <div class="container-table">
        <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-hover table-bordered" id="example">
            <thead>
                <tr>
                    <th>Fecha</th>
                    <th>Importe</th>
                    <th>Nro Cpte Pago</th>
                    <th>Nro Cheque</th>
                    <th>Beneficiario</th>
                    <th>Acciones</th>
                </tr>
            </thead>
            <tbody>
                <?php
                if (!empty($novedades)) {
                    $color = 'odd';
                    foreach ($novedades as $novedad) {
                        $color = ( $color == 'odd') ? 'even' : 'odd';
                        $datos = json_decode($novedad->datos);
                        ?>
                        <tr class="<?php echo $color; ?>">
                            <td><?php echo database_to_normal_date($datos->fecha); ?></td>
                            <td><?php echo $datos->moneda . $datos->importe; ?></td>
                            <td><?php echo $datos->nroCptePago; ?></td>
                            <td><?php echo $datos->nroCheque; ?></td>
                            <td><?php echo $datos->beneficiario; ?></td>
                            <td>
                                <a class="btn btn-small" href="javascript:detalle('<?php echo $datos->id; ?>')"><span class="icon-list-alt"></span> Detalle</a>
                                <a class="btn btn-small btn-info visto" href="javascript:;" id="visto-<?php echo $novedad->id; ?>" dbid="<?php echo $novedad->id; ?>"><span class="icon-check"></span></a>
                            </td>
                        </tr>
                        <?php
                    }
                }
                ?>
            </tbody>
        </table> 
    </div>
</div>

<script type="text/javascript">
    var popup;
    function detalle(id){
        popup = window.open("<?php echo base_url('subsidios/detalle'); ?>/" + id,"miwin","left=200,top=50,width=800,height=500,scrollbars=yes");
        popup.focus();
    }
</script>

<script type="text/javascript">
    $(".visto").click(function(){
        var id = $(this).attr('dbid');
        $.ajax({
            type:"POST",
            url:"<?php echo 'visto/'; ?>" + id,
            success: function(html){
                $("#visto-" + id).fadeOut('fast');
            }
        });
    });
</script>